\(\int \frac {\cos ^2(a+b \log (c x^n))}{x} \, dx\) [94]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 39 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {\log (x)}{2}+\frac {\cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{2 b n} \]

[Out]

1/2*ln(x)+1/2*cos(a+b*ln(c*x^n))*sin(a+b*ln(c*x^n))/b/n

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {2715, 8} \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {\sin \left (a+b \log \left (c x^n\right )\right ) \cos \left (a+b \log \left (c x^n\right )\right )}{2 b n}+\frac {\log (x)}{2} \]

[In]

Int[Cos[a + b*Log[c*x^n]]^2/x,x]

[Out]

Log[x]/2 + (Cos[a + b*Log[c*x^n]]*Sin[a + b*Log[c*x^n]])/(2*b*n)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \cos ^2(a+b x) \, dx,x,\log \left (c x^n\right )\right )}{n} \\ & = \frac {\cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{2 b n}+\frac {\text {Subst}\left (\int 1 \, dx,x,\log \left (c x^n\right )\right )}{2 n} \\ & = \frac {\log (x)}{2}+\frac {\cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{2 b n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.92 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {2 \left (a+b \log \left (c x^n\right )\right )+\sin \left (2 \left (a+b \log \left (c x^n\right )\right )\right )}{4 b n} \]

[In]

Integrate[Cos[a + b*Log[c*x^n]]^2/x,x]

[Out]

(2*(a + b*Log[c*x^n]) + Sin[2*(a + b*Log[c*x^n])])/(4*b*n)

Maple [A] (verified)

Time = 1.41 (sec) , antiderivative size = 30, normalized size of antiderivative = 0.77

method result size
parallelrisch \(\frac {2 \ln \left (x \right ) b n +\sin \left (2 b \ln \left (c \,x^{n}\right )+2 a \right )}{4 b n}\) \(30\)
derivativedivides \(\frac {\frac {\cos \left (a +b \ln \left (c \,x^{n}\right )\right ) \sin \left (a +b \ln \left (c \,x^{n}\right )\right )}{2}+\frac {b \ln \left (c \,x^{n}\right )}{2}+\frac {a}{2}}{n b}\) \(45\)
default \(\frac {\frac {\cos \left (a +b \ln \left (c \,x^{n}\right )\right ) \sin \left (a +b \ln \left (c \,x^{n}\right )\right )}{2}+\frac {b \ln \left (c \,x^{n}\right )}{2}+\frac {a}{2}}{n b}\) \(45\)

[In]

int(cos(a+b*ln(c*x^n))^2/x,x,method=_RETURNVERBOSE)

[Out]

1/4*(2*ln(x)*b*n+sin(2*b*ln(c*x^n)+2*a))/b/n

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.00 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {b n \log \left (x\right ) + \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) \sin \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )}{2 \, b n} \]

[In]

integrate(cos(a+b*log(c*x^n))^2/x,x, algorithm="fricas")

[Out]

1/2*(b*n*log(x) + cos(b*n*log(x) + b*log(c) + a)*sin(b*n*log(x) + b*log(c) + a))/(b*n)

Sympy [A] (verification not implemented)

Time = 1.17 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.31 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {\begin {cases} \log {\left (x \right )} \cos {\left (2 a \right )} & \text {for}\: b = 0 \wedge \left (b = 0 \vee n = 0\right ) \\\log {\left (x \right )} \cos {\left (2 a + 2 b \log {\left (c \right )} \right )} & \text {for}\: n = 0 \\\frac {\sin {\left (2 a + 2 b \log {\left (c x^{n} \right )} \right )}}{2 b n} & \text {otherwise} \end {cases}}{2} + \frac {\log {\left (x \right )}}{2} \]

[In]

integrate(cos(a+b*ln(c*x**n))**2/x,x)

[Out]

Piecewise((log(x)*cos(2*a), Eq(b, 0) & (Eq(b, 0) | Eq(n, 0))), (log(x)*cos(2*a + 2*b*log(c)), Eq(n, 0)), (sin(
2*a + 2*b*log(c*x**n))/(2*b*n), True))/2 + log(x)/2

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.36 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {2 \, b n \log \left (x\right ) + \cos \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) \sin \left (2 \, b \log \left (c\right )\right ) + \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right )}{4 \, b n} \]

[In]

integrate(cos(a+b*log(c*x^n))^2/x,x, algorithm="maxima")

[Out]

1/4*(2*b*n*log(x) + cos(2*b*log(x^n) + 2*a)*sin(2*b*log(c)) + cos(2*b*log(c))*sin(2*b*log(x^n) + 2*a))/(b*n)

Giac [F]

\[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\int { \frac {\cos \left (b \log \left (c x^{n}\right ) + a\right )^{2}}{x} \,d x } \]

[In]

integrate(cos(a+b*log(c*x^n))^2/x,x, algorithm="giac")

[Out]

integrate(cos(b*log(c*x^n) + a)^2/x, x)

Mupad [B] (verification not implemented)

Time = 26.95 (sec) , antiderivative size = 32, normalized size of antiderivative = 0.82 \[ \int \frac {\cos ^2\left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {\ln \left (x^n\right )}{2\,n}+\frac {\sin \left (2\,a+2\,b\,\ln \left (c\,x^n\right )\right )}{4\,b\,n} \]

[In]

int(cos(a + b*log(c*x^n))^2/x,x)

[Out]

log(x^n)/(2*n) + sin(2*a + 2*b*log(c*x^n))/(4*b*n)